# $Id$
# Maintainer:  Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Dave Reisner <dreisner@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>

pkgname=mkinitcpio-busybox
pkgver=1.29.3
pkgrel=1
pkgdesc='Base initramfs tools'
arch=(x86_64)
url="http://www.busybox.net/"
license=(GPL)
depends=(glibc)
options=(!buildflags)
source=(https://busybox.net/downloads/busybox-$pkgver.tar.bz2
        config)
sha256sums=('97648636e579462296478e0218e65e4bc1e9cd69089a3b1aeb810bff7621efb7'
            '2d23922f81a2ebd014463b8ec8d9a6c9845300b921c3a207d4a9144c3cb21cc5')

prepare() {
  cd "busybox-$pkgver"

  local safeflags="-march=${CARCH/_/-} -mtune=generic -Os -pipe -fno-strict-aliasing"

  sed 's|^\(CONFIG_EXTRA_CFLAGS\)=.*|\1="'"$safeflags"'"|' "$srcdir/config" > .config
}

build() {
  make -C "busybox-$pkgver"
}

package() {
  install -Dm755 "$srcdir/busybox-$pkgver/busybox" "$pkgdir/usr/lib/initcpio/busybox"
}
